package com.wrb.manage.service;

import com.wrb.manage.mapper.CouponTemplateMapper;
import com.wrb.manage.model.CouponTemplate;
import com.wrb.manage.model.CouponTemplateCriteria;
import com.wrb.manage.utils.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wrb
 * @date 2019/12/5 15:40
 */
@Service
public class CouponTemplateService {

	@Autowired
	private CouponTemplateMapper couponTemplateMapper;

	public int insertCouponTemplate(CouponTemplate couponTemplate) {
		return this.couponTemplateMapper.insertSelective(couponTemplate);
	}

	public List getList() {
		CouponTemplateCriteria criteria = new CouponTemplateCriteria();
		criteria.setOrderByClause(" create_time desc");
		return this.couponTemplateMapper.selectByExample(criteria);
	}

	public CouponTemplate getByKey(long couponTemplateId) {
		return this.couponTemplateMapper.selectByPrimaryKey(couponTemplateId);
	}
}
